@extends('default.layouts.adminPublic')
@section('title', '修改广告管理')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/vendor/jedate/skin/jedate.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/admin/indexList.css')}}">
    <style>
        .wicon{background-image: url("");
            background-repeat:no-repeat; background-position:right center;  cursor:pointer;
        }

    </style>
    @endsection
    @section('content')
            <!--导航开始-->
    <div class="crumb_warp">
        <i class="fa fa-home"></i> <a href="{{url('admin/ad_manage')}}">首页</a> &raquo; 修改广告管理
    </div>
    <!--导航结束-->
    <!--结果集标题与导航组件 开始-->
    <div class="con">

        <div class="conMain">
            <div class="result_wrap">
                <div class="search">
                    <span style="margin-right: 20px;"><a href="{{url('admin/ad_manage/create')}}"><i class="fa fa-plus"></i>添加广告</a></span>
                    <span ><a href="{{url('admin/ad_manage')}}"><i class="fa fa-recycle"></i>广告列表</a></span>
                </div>
                <div class="message"><h2>修改广告</h2></div>
            </div>
            <div class="conInfo">
                <div class="manage" style="padding: 0; margin-bottom: 10px;">
                    @if(count($errors)>0)
                        <div class="mark">
                            @if(is_object($errors))
                                @foreach($errors->all() as $error)
                                    <p>{{$error}}</p>
                                @endforeach
                            @else
                                <p>{{$errors}}</p>
                            @endif
                        </div>
                    @endif
                </div>
                <div class="conAddList">
                    <form  method="post" action="{{url('admin/ad_manage/'.$adManage->id)}}"  onsubmit="return checkForm('#adManageForm')"  name="adManageForm" id="adManageForm" enctype="Multipart/form-data">
                        {{csrf_field()}}
                        <input type="hidden" name="_method" value="put">
                        <input type="hidden" name="id" value="{{$adManage->id}}">
                        <dl>
                            <dt><i class="require">*</i>广告名称：</dt>
                            <dd><input type="text" class="inpText" style="width:525px;" value="{{$adManage->title}}" name="title" id="title"></dd>
                        </dl>
                        <dl>
                            <dt><i class="require">*</i>链接类型：</dt>
                            <dd>
                                <input name="uid" value="" id="uid" type="hidden">
                                <input name="com_id" value="" id="com_id" type="hidden">
                                <select name="url_type" id="url_type" style="width:120px;">
                                    <option value="1">url地址</option>
                                    <option value="2">公司ID</option>
                                    <option value="3">职位ID</option>
                                </select>
                                <input type="text" class="inpText" style="width: 400px;" value="{{$adManage->url}}" name="url" id="url">
                            </dd>
                        </dl>
                        <dl>
                            <dt><i class="require">*</i>图片地址：</dt>
                            <dd>
                                <input name="pic_url" value="{{$adManage->pic_url}}" type="file">
                                <span style="color: #ff4400">注：文件类型只能为 png, jpeg , jpg 或 gif的图片！</span>
                            </dd>
                        </dl>
                        <dl>
                            <dt><i class="require">*</i>广告位置：</dt>
                            <dd>
                                <select name="ad_slots" id="ad_slots" style="width:260px;">
                                    <option value="">请选择广告位置</option>
                                    @if(count($ad_slots) > 0)
                                        @foreach($ad_slots as $v )
                                            <option value="{{$v->id}}">{{$v->ad_name}}</option>
                                        @endforeach
                                    @endif
                                </select>
                            </dd>
                        </dl>
                        <dl>
                            <dt><i class="require">*</i>广告站点：</dt>
                            <dd>
                                <select name="ad_site" id="ad_site" style="width:260px;">
                                    <option value="">请选择广告站点</option>
                                    @if(count($ad_site) > 0)
                                        @foreach($ad_site as $v )
                                            <option value="{{$v->id}}">{{$v->site_name}}</option>
                                        @endforeach
                                    @endif
                                </select>
                            </dd>
                        </dl>
                        <dl>
                            <dt><i class="require">*</i>广告时间：</dt>
                            <dd>
                                <input class="wicon" name="start_time" style="width:180px;" id="start_time" value="{{substr($adManage->start_time,0,10)}}" type="text" readonly>
                                <span>~</span>
                                <input class="wicon" name="end_time" style="width:180px;" id="end_time"  value="{{substr($adManage->end_time,0,10)}}" type="text" readonly>
                            </dd>
                        </dl>
                        <dl>
                            <dt>图片宽高：</dt>
                            <dd>
                                <input name="width" style="width:150px;" id="width" value="{{$adManage->width}}" type="text" >
                                <span>~</span>
                                <input name="height" style="width:150px;" id="height"  value="{{$adManage->height}}" type="text"  >
                                <span style="color: #999">注：只允许填写像素</span>
                            </dd>
                        </dl>
                        <dl style="height: 100px;">
                            <dt style="height: 100px;">说明：</dt>
                            <dd style="height: 100px;"><textarea name="explanation" id="explanation" style="height: 68px; width:525px;">{{$adManage->explanation}}</textarea></dd>
                        </dl>
                        <dl>
                            <dt></dt>
                            <dd>
                                <input type="submit" class="sub" value="修改广告">
                                <input type="button" class="sub but" onclick="history.go(-1)" value="返回">
                            </dd>
                        </dl>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!--结果集标题与导航组件 结束-->
@endsection

@section('footerjs')
    @parent
    <script type="text/javascript" src="{{asset('/vendor/jedate/jquery.jedate.min.js')}}"></script>
    <script type="text/javascript">
        //蓝色风格
        $.jeDate('#start_time',{
            isinitVal:true,
            format: 'YYYY-MM-DD',
            festival: true
        });
        $.jeDate('#end_time',{
            isinitVal:true,
            format: 'YYYY-MM-DD',
            festival: true
        });

        $(function() {
            var adManageForm = $('#adManageForm');
            adManageForm.find('#url_type').val('{{$adManage->url_type}}');
            adManageForm.find('#ad_slots').val('{{$adManage->ad_slots}}');
            adManageForm.find('#ad_site').val('{{$adManage->ad_site}}');
        });
    </script>
@endsection